-- 离群准则
local liqunzhunze = fk.CreateSkill {
    name = "mcdh_liqunzhunze",
    tags = {Skill.Compulsory}
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

liqunzhunze:addEffect(fk.TargetConfirmed,{
    can_trigger = function(self, event, target, player, data)
        return  player:hasSkill(self) and not data:isOnlyTarget(player) and target== player
    end,
    on_use =  function(self, event, target, player, data)
        local room = player.room
        local choices = {"mcdh_liqunzhunze1","mcdh_liqunzhunze2"}
        if lib.mcdh_getLoseammo(player) == 0 then
            table.removeOne(choices,"mcdh_liqunzhunze1")
        end
        local  choice = room:askForChoice(player,  choices , self.name, self.name, false, {"mcdh_liqunzhunze1","mcdh_liqunzhunze2"})
        if choice == "mcdh_liqunzhunze1" then
            lib.LoadAmmo(player,player,1,self.name)
        elseif choice =="mcdh_liqunzhunze2" then
            table.insertIfNeed(data.nullifiedTargets, player)
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_liqunzhunze"] = "离群",
    [":mcdh_liqunzhunze"] = "『离群准则』<br>锁定技，当你成为非装备牌的目标后，若你不是此牌的唯一目标，你选择一项：1.装填一枚弹药;2.令此牌对你无效。",
    ["mcdh_liqunzhunze1"] ="装填一发弹药",
    ["mcdh_liqunzhunze2"] = "令此牌对你无效"
}

return liqunzhunze